package com.dragon.repository.domain.dto;

import com.dragon.repository.entity.RequisitionProduct;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.dragon.common.util.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RequisitionProductDTO {

    private static final long serialVersionUID = 1L;

    private Integer id;

    @ApiModelProperty(value = "请购单id")
    private Integer requisitionId;

    @ApiModelProperty(value = "物品SPU_id")
    private Integer productSpuId;

    @ApiModelProperty(value = "购买数量")
    private Double productBuyNum;

    @ApiModelProperty(value = "单位id")
    private Integer unitId;

    @ApiModelProperty(value = "单价")
    private Double price;

    @ApiModelProperty(value = "总金额")
    private Double productBuyPrice;

    @ApiModelProperty(value = "物品生单状态：1未生单2已生单")
    private Integer productState;


    public RequisitionProductDTO() {}

    public RequisitionProductDTO(RequisitionProduct entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static RequisitionProductDTO convert(RequisitionProduct entity) {
        return new RequisitionProductDTO(entity);
    }

    public static List<RequisitionProductDTO> convertList(List<RequisitionProduct> list) {
        List<RequisitionProductDTO> resultList = new ArrayList<>();
        for (RequisitionProduct entity : list) {
            resultList.add(new RequisitionProductDTO(entity));
        }
        return resultList;
    }}
